package com.liutaw.nanjingair.views.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.liutaw.nanjingair.R;
import com.liutaw.nanjingair.views.adapter.OtherCityAdapter;
import com.liutaw.navigationbarlib.NaviBarBuilder;

import butterknife.Bind;
import butterknife.ButterKnife;

public class OtherCityFragment extends Fragment {
    @Bind(R.id.navi_container)
    FrameLayout navi_container;
    NaviBarBuilder navigationBarView;
    @Bind(R.id.recyclerview_othercity)
    RecyclerView recyclerview_othercity;
    private OtherCityAdapter otherCityAdapter;

    public OtherCityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_fragment_othercity, container, false);
        ButterKnife.bind(this, view);
        navigationBarView = new NaviBarBuilder(getActivity());
        navigationBarView.buildCenterView().buildTitleText("其它城市").buildRightView().buildImg(R.drawable.icon_add);
        navi_container.addView(navigationBarView.build());

        otherCityAdapter = new OtherCityAdapter(getContext());
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerview_othercity.setLayoutManager(linearLayoutManager);
        recyclerview_othercity.setAdapter(otherCityAdapter);

        return view;
    }
}
